package com.ruoyi.net.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.net.mapper.ElementSrSrtpProtectMapper;
import com.ruoyi.net.domain.ElementSrSrtpProtect;
import com.ruoyi.net.service.IElementSrSrtpProtectService;

/**
 * 网元-SR-srtp-保护属性Service业务层处理
 * 
 * @author net
 * @date 2024-11-17
 */
@Service
public class ElementSrSrtpProtectServiceImpl implements IElementSrSrtpProtectService 
{
    @Autowired
    private ElementSrSrtpProtectMapper elementSrSrtpProtectMapper;

    /**
     * 查询网元-SR-srtp-保护属性
     * 
     * @param id 网元-SR-srtp-保护属性主键
     * @return 网元-SR-srtp-保护属性
     */
    @Override
    public ElementSrSrtpProtect selectElementSrSrtpProtectById(String id)
    {
        return elementSrSrtpProtectMapper.selectElementSrSrtpProtectById(id);
    }

    /**
     * 查询网元-SR-srtp-保护属性列表
     * 
     * @param elementSrSrtpProtect 网元-SR-srtp-保护属性
     * @return 网元-SR-srtp-保护属性
     */
    @Override
    public List<ElementSrSrtpProtect> selectElementSrSrtpProtectList(ElementSrSrtpProtect elementSrSrtpProtect)
    {
        return elementSrSrtpProtectMapper.selectElementSrSrtpProtectList(elementSrSrtpProtect);
    }

    /**
     * 新增网元-SR-srtp-保护属性
     * 
     * @param elementSrSrtpProtect 网元-SR-srtp-保护属性
     * @return 结果
     */
    @Override
    public int insertElementSrSrtpProtect(ElementSrSrtpProtect elementSrSrtpProtect)
    {
        String uuid = IdUtils.simpleUUID();
        if (StringUtils.isEmpty(elementSrSrtpProtect.getId())) {
            elementSrSrtpProtect.setId(uuid);
        }
        elementSrSrtpProtect.setCreateBy(SecurityUtils.getUsername());
        elementSrSrtpProtect.setCreateTime(DateUtils.getNowDate());
        elementSrSrtpProtect.setUpdateBy(SecurityUtils.getUsername());
        elementSrSrtpProtect.setUpdateTime(DateUtils.getNowDate());
        return elementSrSrtpProtectMapper.insertElementSrSrtpProtect(elementSrSrtpProtect);
    }

    /**
     * 修改网元-SR-srtp-保护属性
     * 
     * @param elementSrSrtpProtect 网元-SR-srtp-保护属性
     * @return 结果
     */
    @Override
    public int updateElementSrSrtpProtect(ElementSrSrtpProtect elementSrSrtpProtect)
    {
        elementSrSrtpProtect.setUpdateBy(SecurityUtils.getUsername());
        elementSrSrtpProtect.setUpdateTime(DateUtils.getNowDate());
        return elementSrSrtpProtectMapper.updateElementSrSrtpProtect(elementSrSrtpProtect);
    }

    /**
     * 批量删除网元-SR-srtp-保护属性
     * 
     * @param ids 需要删除的网元-SR-srtp-保护属性主键
     * @return 结果
     */
    @Override
    public int deleteElementSrSrtpProtectByIds(String[] ids)
    {
        return elementSrSrtpProtectMapper.deleteElementSrSrtpProtectByIds(ids);
    }

    /**
     * 删除网元-SR-srtp-保护属性信息
     * 
     * @param id 网元-SR-srtp-保护属性主键
     * @return 结果
     */
    @Override
    public int deleteElementSrSrtpProtectById(String id)
    {
        return elementSrSrtpProtectMapper.deleteElementSrSrtpProtectById(id);
    }
}
